package com.itic.web.mem.member.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import com.itic.appbase.framework.common.controller.BaseController;
import com.itic.appbase.framework.plugins.mybatis.Page;
import com.itic.web.mem.member.service.AppMemberInfoService;
import com.itic.web.qo.TokenData;
import com.itic.web.ro.ResResult;



@Controller
@RequestMapping(value="/app/member")
public class AppMemberController extends BaseController {
    @Autowired
    private AppMemberInfoService memberService;

    
    /**
     * 获取用户信息
     */
    @RequestMapping(value="/getMemInfo")
    @ResponseBody
    public ResResult getMemInfo(TokenData data){
    	return memberService.getMemInfo(data);
    }
    
    /**
     * 更新用户姓名
     */
    @RequestMapping(value="/updateMemName")
    @ResponseBody
    public ResResult updateMemName(TokenData data,String realname){
    	return memberService.updateMemName(data,realname);
    }
    

    /**
     * 更新用户头像
     */
	@RequestMapping(value = "/updateMemImage")
	@ResponseBody
	public ResResult updateMemImge(HttpServletRequest request, @RequestParam MultipartFile file,TokenData data) throws Exception {
		
		System.out.println("进入接口updateMemImage"+data.getToken());
		// 保存视频
		if (file != null) {
			return memberService.updateMemOSSImage(request, file, data);
		} else {
			return ResResult.error(1, "头像保存异常");
		}
		
	}
	/**
	 * 我的二维码
	 */
	@RequestMapping(value = "/getMemCode")
	@ResponseBody
	public ResResult getMemCode(TokenData data) {
		
		return memberService.getMemCode(data);
		
	}
	/**
	 * 我的团队
	 */
	@RequestMapping(value = "/getMemUpRelation")
	@ResponseBody
	public ResResult getMemUpRelation(TokenData data) {
		
		return memberService.getMemUpRelation(data);
		
	}
	/**
	 * 我的二维码
	 */
	@RequestMapping(value = "/getMemDownRelation")
	@ResponseBody
	public ResResult getMemDownRelation(TokenData data,Page page) {
		
		return memberService.getMemDownRelation(data,page);
		
	}
    
	/**
	 * 私照考试与考题学习
	 *//*
	@RequestMapping(value = "/assertSuperToken")
	@ResponseBody
	public ResResult assertSuperToken(TokenData data,String category,String etype){
		return memberService.assertSuperToken(data,category,etype);
	}*/
    
}